import { authApi } from "/utils/request/post.js";
const appName = "TRIPLE_INTERVIEW"; // 拜访助手

// 查询每日推荐内容
export async function reqDailyRecommend(userId, scene) {
  const res = await authApi({
    userId,
    appName,
    scene,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_perdaterec",
  });
  return res;
}

// 文案生成结果查询 (轮询)
export async function reqBotResult(userId, promptId) {
  const res = await authApi({
    userId,
    appName,
    promptId,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_queryGenerationResult",
  });
  return res;
}

// 自由创作
export async function reqFreeTalk(userId, content, scene, promptId, contentList) {
  const res = await authApi({
    userId,
    appName,
    scene,
    content,
    promptId,
    contentList,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_selfcreate",
  });
  return res;
}

// 查询引导选项
export async function reqGuideOptions(userId) {
  const res = await authApi({
    userId,
    appName,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_guidanceOptions",
  });
  return res;
}

// 查询引导选项
export async function reqGuideResult(userId, scene, optionName, promptId) {
  const res = await authApi({
    userId,
    appName,
    scene,
    optionName,
    promptId,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_generationByGuidance",
  });
  return res;
}

/**
 * 查询aigc文案生成历史对话记录
 * @param {Array} sceneList 
 * 场景ID：（1～9 常规场景默认使用旧接口；如需包含10～15需使用新接口）
 *  1：每日推荐；3：每日推荐重新生成；
    4：自由创作；6：自由创作重新生成；
    7：引导创作；9：引导创作重新生成；
    10：智能选题跳转短视频脚本生成；11：智能选题跳转短视频脚本重新生成
    12：智能选题跳转画报脚本生成；13：智能选题跳转画报脚本重新生成
    14：IP打造小工具脚本生成；15：IP打造小工具脚本重新生成
*/
export async function reqSessionHistory(userId, pageNum, endTime, scene) {
  let method, sceneList;
    switch (scene) {
    case "smartTopic":
      method = "tritalks_ipworkshop_aiTool_aiVideoScript_queryHistoryByScene";
      sceneList = [1, 3, 4, 6, 7, 9, 10, 11, 12, 13];
      break;
    case "buildIP":
      method = "tritalks_ipworkshop_aiTool_aiVideoScript_queryHistoryByScene";
      sceneList = [14, 15];
      break;
    default:
      method = "tritalks_ipworkshop_aiTool_aiVideoScript_queryHistory";
      sceneList = [];   // 传空即可 旧接口默认含1～9场景
      break;
  }
  const res = await authApi({
    userId,
    appName,
    pageNum,
    endTime,
    pageSize: 10,
    sceneList,
    method,
  });
  return res;
}

// 文案生成结果查询 (轮询)
export async function reqIpResult(userId, promptId) {
  const res = await authApi({
    userId,
    appName,
    promptId,
    method: "tritalks_ipworkshop_aiTool_aiVideoScript_queryGenerationResultNewline",
  });
  return res;
}
